package com.shihb.chapter02function

object Demo04Lazy {
  def main(args: Array[String]): Unit = {
    // 添加了lazy 关键字sum被使用了才会取执行
    lazy val res = sum(10, 20)
    println("==========")
    println(res)
  }

  def sum(n1:Int,n2:Int) ={
    println("sum被执行了")
    n1+n2
  }
}
